package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.LogBean;
import com.project.dao.ILogDao;
import com.project.service.ILogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

/**
 * @author RJ
 * @date 2022/9/14 15:09
 */
@Service
@Transactional
public class LogServiceImpl extends ServiceImpl<ILogDao, LogBean> implements ILogService {
    @Override
    public IPage<LogBean> cutLogByDate(Integer pageNo, Integer pageSize, LocalDate startDate, LocalDate endDate) {
        Page<LogBean> page = new Page<>(pageNo, pageSize);
        IPage<LogBean> iPage = this.baseMapper.cutLogByDate(page, startDate, endDate);
        return iPage;
    }

    @Override
    public void addLog(LogBean logBean) {
        this.save(logBean);
    }
}
